﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;

namespace sccf
{
    public partial class About : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            TextBox3.Text = System.DateTime.Now.Year.ToString();
            CalendarExtender1.SelectedDate = System.DateTime.Today.AddDays(1);
            CalendarExtender1.StartDate = System.DateTime.Today.AddDays(1);
            CalendarExtender1.EndDate = System.DateTime.Today.AddDays(9);
            int resp = SolicitarAgendaController.Consultar();
            string razon = "Ya hay una solicitud creada";
            if (resp == 1)
                Response.Redirect("NoAccess2.aspx?razon=" + razon, true);
        }


        protected void Button_Enviar_Click(object sender, EventArgs e)
        {
            
            string result = SolicitarAgendaController.Registrar(Convert.ToInt16(TextBox2.Text+TextBox3.Text), TextArea_Indic.InnerText, Convert.ToDateTime(TextBox1.Text));
            if (result.CompareTo("") != 0)
            {
                WebMsgBox.Show(result);
            }
            Response.Redirect("Default.aspx");
        }

        protected void CalendarExtender1_PreRender(object sender, EventArgs e)
        {
            
        }
    }
}
